﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WorldEvolution
{
    public class Cell
    {
        public int x { get { return mData.x; } }
        public int y { get { return mData.y; } }

        public ElementData Element { get { return mElement; } }

        public Cell Top;
        public Cell Bottom;
        public Cell Left;
        public Cell Right;

        public static Cell Create(int cx, int cy)
        {
            var c = new Cell();
            c.mData.x = cx;
            c.mData.y = cy;
            return c;
        }

        public void FillElements(byte[] e, int start)
        {
            mElement.FillData(e, start);
        }

        public void Evolute()
        {
            if(mEntitys.Count == 0)
            {
                var entity = Entity.Born<NoliveEntity>(this);
                AddEntity(entity);

            }
        }

        public void AddEntity(Entity e)
        {
            mEntitys.Add(e);
        }



        List<Entity> mEntitys = new List<Entity>();
        ElementData mElement = new ElementData();
        DBData.CellData mData;

    }
}
